<?php
class pfElement {

	/**
	 * 
	 * @var pfField
	 */
	private $field;

	/**
	 * 
	 * @var pfFieldValue
	 */
	private $value;

	/**
	 * 
	 */
	protected function __contruct($type, $name, $id = null, $method = null) {
		$this->field = pfField::factory($type, $name, $id);
		$this->value = new pfFieldValue($this->field, $method);
	}

	/**
	 * 
	 * @return pfField
	 */
	public function getField() {
		return $this->field;
	}

	/**
	 * 
	 * @return pfFieldValue
	 */
	public function getValue() {
		return $this->value;
	}
	
	/**
	 * 
	 * @param	string $default
	 */
	public function setDefault($default) {
		$this->value->setDefault($default);
	}

	/**
	 * 
	 * @return string
	 */
	public function __toString() {
		return pfField::getFieldRenderer()->render($this->field, $this->value);
	}
}